package com.icloud.cer.rest.msg.bean;

import java.io.IOException;

import com.icloud.cer.rest.Constants;
import com.icloud.cer.rest.msg.AbsMsgObject;
import com.icloud.cer.rest.msg.BDataFilterInputStream;
import com.icloud.cer.rest.msg.DataFilterOutputStream;

public class RegistInfo extends AbsMsgObject<RegistInfo>{

	public static final int BYTE_COUNT = 96;
	private byte[] encryptorName ;
	private byte[] encryptorId;
	private int loginRet; 

	private String encryptorNameStr;
	private String encryptorIdStr;
	

	public byte[] getEncryptorName() {
		return encryptorName;
	}

	public void setEncryptorName(byte[] encryptorName) {
		this.encryptorName = encryptorName;
	}

	public byte[] getEncryptorId() {
		return encryptorId;
	}

	public void setEncryptorId(byte[] encryptorId) {
		this.encryptorId = encryptorId;
	}
	
	public int getLoginRet() {
		return loginRet;
	}
	
	public void setLoginRet(int loginRet) {
		this.loginRet = loginRet;
	}

	public String getEncryptorNameStr() {
		return encryptorNameStr;
	}

	public void setEncryptorNameStr(String encryptorNameStr) {
		this.encryptorNameStr = encryptorNameStr;
	}

	public String getEncryptorIdStr() {
		return encryptorIdStr;
	}

	public void setEncryptorIdStr(String encryptorIdStr) {
		this.encryptorIdStr = encryptorIdStr;
	}


	@Override
	protected void doSerialize(DataFilterOutputStream dos) throws IOException {
		dos.writeInt(loginRet);
	}

	@Override
	protected RegistInfo doDeserialize(BDataFilterInputStream dis) throws IOException {
		encryptorName = new byte[64];
		encryptorId = new byte[32];
		
		dis.read(encryptorName);
		dis.read(encryptorId);

		encryptorNameStr = new String(encryptorName, Constants.CHARSET).trim();
		encryptorIdStr = new String(encryptorId, Constants.CHARSET).trim();
		return this;
	}

}
